package com.moutai.wmo.core.result;

import lombok.Getter;


/**
 * 响应结果枚举
 */
@Getter
public enum ResultEnum {
    OPERATE_SUCCESS(0, "操作成功!"),//成功默认，实际返回msg可变
    OPERATE_FAILURE(4000, "操作失败!"),//失败默认，实际返回msg可变

    SUCCESS(0, "请求成功"),
    QUERY_SUCCESS(0, "查询成功!"),
    DELETE_SUCCESS(0, "删除成功!"),
    INSERT_SUCCESS(0, "新增成功!"),
    UPDATE_SUCCESS(0, "修改成功!"),
    LOGIN_IN_SUCCESS(0, "登录成功!"),
    LOGIN_OUT_SUCCESS(0, "退出成功!"),

    PARAMETER_ERROR(1001, "请求参数有误!"),
    CONVERT_TYPE_ERROR(1002, "类型转换失败!"),
    AUTHORITY_FAILURE(2000, "权限不足!"),
    LOGIN_FAILURE_200401(2001, "登录失败!"),
    LOGIN_FAILURE_200402(2002, "登录信息已过期!"),
    LOGIN_FAILURE_200403(2003, "尚未登录，请登录!"),
    QUERY_FAILURE(3001, "查询失败!"),
    DELETE_FAILURE(3002, "删除失败!"),
    INSERT_FAILURE(3003, "新增失败!"),
    UPDATE_FAILURE(3004, "修改失败!"),
    SQL_FAILURE(3000, "数据库异常!"),
    SERVICE_FAILURE(5000, "服务器异常！"),
    HTTP_FAILURE(6000, "请求异常!"),
    WX_PAY_EXCEPTION(5001, "微信异常"),
    UNKNOWN_ERROR(9999, "未知的错误!");


    private Integer code; //0表示操作成功，其它表示异常。
    private String message; //消息

    ResultEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public ResultEnum setMessage(String message) {
        this.message = message;
        return this;
    }
}
